<!DOCTYPE html>
<html lang="en">

<head>
    <{include file="header.html" }>
        <title>添加学员-学员管理-
            <{$user_data[ 'school_name']}>-德安信会计在线教育平台</title>
        <script>
        $(function() {


            $("#btn_save").click(function() {
                $("form").submit();
            });
        })
        </script>
</head>

<body>
    <div class="wrap">
        <!--star left-->
        <div class="column">
            <{include file="left_menu.html" }>
        </div>
        <div id="ContMianBox">
            <!--star子栏目-->
            <div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
                <!--end子栏目-->
                <!--end left-->
                <div class="container narrow">
                    <!--star conter-->
                    <div class="cetContent">
                        <div class="tit p-lr20">
                            <a class="c-40d064" href="/student">学员管理</a><em class="p-lr10 c-CCCCCC fs12">/</em><em>添加学员</em>
                        </div>
                        <!--star内容区域-->
                        <div class="mainScroll">
                            <div class="mainContainer line-all">
                            <ul class="ui-nav-tab wList33">
                                <li class="js-step-1 active"><a href="javascript:;">1.添加学员基本信息</a></li>
                                <li class="js-step-2"><a href="javascript:;">2.分配课程科目</a></li>
                            </ul>
                                <div class="tabMainCont">
                                    <!--star 编辑基本信息-->
                                    <div class="tabItem step-02">
                                    <form class="layui-form" action="/student/add" method="post" class="edit_info">
                                     <div class="layui-form-item">
				                        <label class="layui-form-label">选择校区*</label>
				                        <div class="layui-input-inline">
				                          <select name="campus" id="campus" lay-filter="aihao" lay-verify="required">
				                            <option value="">请选择报名校区</option>
				                            <{if empty($campus)}>
				                              <option value="0">总部校区</option>
				                            <{else}>
				                            <{foreach from=$campus item=item}>
				                              <option value="<{$item['id']}>"><{$item['name']}></option>
				                            <{/foreach}>
				                            <{/if}>
				                            </select>
				                        </div>
				                      </div>
									  <div class="layui-form-item" style="padding-top:15px">
									    <label class="layui-form-label">姓名*</label>
									    <div class="layui-input-inline">
									      <input value="<{if isset($student)}><{$student['name']}><{/if}>" type="text" name="name" id="name"  required lay-verify="required" autocomplete="off" placeholder="请输入姓名" class="layui-input">
									    </div>

									    <label class="layui-form-label">手机*</label>
									    <div class="layui-input-inline">
									      <input value="<{if isset($student)}><{$student['phone']}><{/if}>" type="number" name="phone" id="phone" oninput="if(value.length>11)value=value.slice(0,11)" lay-verify="phone" lay-verify="required" placeholder="手机号用于登录网校" autocomplete="off" class="layui-input">
									    </div>
									  </div>
									  <div class="layui-form-item">
									    <div class="layui-inline">
									      <label class="layui-form-label">生日</label>
									      <div class="layui-input-inline">
									        <input value="<{if isset($student)}><{$student['birthday']}><{/if}>" type="text" name="birthday" id="birthday" lay-verify="date" placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
									      </div>
									    </div>

									    <label class="layui-form-label">性别</label>
									    <div class="layui-input-inline">
									      <{if isset($student)}>
									      <input type="radio" name="sex" value="1" title="男" <{if $student['sex']==1 }>checked=""<{/if}> >
									      <input type="radio" name="sex" value="2" title="女" <{if $student['sex']==2 }>checked=""<{/if}> >
									      <{else}>
									      <input type="radio" name="sex" value="1" title="男" checked="">
									      <input type="radio" name="sex" value="2" title="女">
									      <{/if}>


									    </div>
									  </div>


									  <div class="layui-form-item">
									    <label class="layui-form-label">微信</label>
									    <div class="layui-input-inline">
									      <input value="<{if isset($student)}><{$student['wx']}><{/if}>" placeholder="请填写微信" type="text" name="wx" id="wx"   autocomplete="off" class="layui-input">
									    </div>

									    <div class="layui-inline">
									      <label class="layui-form-label">QQ</label>
									      <div class="layui-input-inline">
									        <input value="<{if isset($student)}><{$student['qq']}><{/if}>" type="text" placeholder="请填写QQ号" name="qq" id="qq" autocomplete="off" class="layui-input">
									      </div>
									    </div>
									  </div>


									  <div class="layui-form-item">
									    <label class="layui-form-label">学历*</label>
									    <div class="layui-input-inline">
									      <select name="edu" id="edu" lay-filter="aihao" lay-verify="required">
									        <option value=""></option>
									        <{if isset($student)}>
									        <option value="1" <{if $student['edu']==1 }>selected<{/if}> >高中</option>
									        <option value="2" <{if $student['edu']==2 }>selected<{/if}> >大专</option>
									        <option value="3" <{if $student['edu']==3 }>selected<{/if}> >本科</option>
									        <option value="4" <{if $student['edu']==4 }>selected<{/if}> >研究生</option>
									        <option value="9" <{if $student['edu']==9 }>selected<{/if}> >其他</option>
									        <{else}>
									        <option value="1" >高中</option>
									        <option value="2" >大专</option>
									        <option value="3">本科</option>
									        <option value="4">研究生</option>
									        <option value="9">其他</option>
									        <{/if}>

									      </select>
									    </div>

									    <label class="layui-form-label">是否在职*</label>
									    <div class="layui-input-inline">
									      <select name="on_job" id="on_job" lay-filter="aihao" lay-verify="required">
									        <option value=""></option>
									        <{if isset($student)}>
									        <option value="0" <{if $student['on_job']==0 }>selected<{/if}>>非在职</option>
									        <option value="1" <{if $student['on_job']==1 }>selected<{/if}>>在职</option>
									        <{else}>
									        <option value="0">非在职</option>
									        <option value="1" >在职</option>
									        <{/if}>
									      </select>
									    </div>
									  </div>


									  <div class="layui-form-item">
									    <label class="layui-form-label">上课时间</label>
									    <div class="layui-input-block">

									      <input type="checkbox" name="class_time[]" value="0" title="不限">
									      <input type="checkbox" name="class_time[]" value="1" title="白天">
									      <input type="checkbox" name="class_time[]" value="2" title="晚上">
									      <input type="checkbox" name="class_time[]" value="3" title="周末">
									      <input type="checkbox" name="class_time[]" value="4" title="工作日">

									    </div>
									  </div>
									  <div class="layui-form-item">
									    <label class="layui-form-label">住址*</label>
									    <div class="layui-input-block">
									      <input lay-verify="required" value="<{if isset($student)}><{$student['address']}><{/if}>" type="text" placeholder="请输入详细住址，省、市、区、街道 " name="address" id="address" pl autocomplete="off" class="layui-input">
									    </div>
									  </div>

									  <div class="layui-form-item layui-form-text">
									    <label class="layui-form-label">备注信息</label>
									    <div class="layui-input-block">
									      <textarea name="remark" id="remark" style="width:460px;" placeholder="请输入备注内容" class="layui-textarea"><{if isset($student)}><{$student['remark']}><{/if}></textarea>
									    </div>
									  </div>

									  <div class="layui-form-item">
									    <div class="layui-input-block">
									      <button class="layui-btn" lay-submit="" lay-filter="demo1">保存</button>
									      <button type="reset" class="layui-btn layui-btn-primary">重置</button>

									    </div>
									  </div>
									</form>
                                    </div>
                                    <!--end 编辑基本信息-->
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--end内容区域-->
                    <!--end conter-->
                </div>
        </div>
    </div>
    <{include file="footer.html"}>
    <script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form()
  ,layer = layui.layer
  ,laydate = layui.laydate;

  //自定义验证规则
  form.verify({
    phone: function(value){
      if(!(/^1[34578]\d{9}$/.test(value))){
        return "手机号码有误，请重填";
      }
    }

  });

    var birthday = {
      min: laydate.now(-20000)
      ,max: laydate.now()
      ,istoday: false
      ,choose: function(datas){
        birthday.min = datas; //开始日选好后，重置结束日的最小日期
        birthday.start = datas //将结束日的初始值设定为开始日
      }
    };


    document.getElementById('birthday').onclick = function(){
      birthday.elem = this;
      laydate(birthday);
    }

  //监听提交
  form.on('submit(demo1)', function(data){
    
    var class_time =[];
    $('input[name="class_time[]"]:checked').each(function(){
      class_time.push($(this).val());
    });
    if(class_time.length==0){
      class_time = "";
    }
    if(class_time==""){
      layer.msg('请选择上课时间');
      return false;
    }
    
  });
  //监听提交
  // form.on('submit(demo1)', function(data){
  //   // layer.alert(JSON.stringify(data.field), {
  //   //   title: '最终的提交信息'
  //   // })
  //   // parent.$('#order_submit').text('我被改变了');
  //   // parent.layer.tips('Look here', '#order_submit', {time: 5000});
  //   // parent.layer.close(index);
  //   // var name = $("#name").val();
  //   // var phone = $("#phone").val();
  //   // var birthday = $("#birthday").val();
  //   // var sex = $('input[name="sex"]:checked ').val();
  //   // var wx = $("#wx").val();
  //   // var qq = $("#qq").val();
  //   // var edu = $("#edu").val();
  //   // var on_job = $("#on_job").val();
  //   // var class_time =[];
  //   // $('input[name="class_time"]:checked').each(function(){
  //   // class_time.push($(this).val());
  //   // });
  //   // if(class_time.length==0){
  //   //   class_time = "";
  //   // }

  //   // var address = $("#address").val();
  //   // var remark = $("#remark").val();

 

  //   return true;
  // });


});
</script>
</body>

</html>
